home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1997
/
HAM Radio 1997.iso
/
vcls
/
moden
/
admoddb.int
< prev
next >
Wrap
Text File
|
1996-04-08
|
5KB
|
154 lines
{$G+,X+,F+}
{Conditional defines that may affect this unit}
{$I AWDEFINE.INC}
{*********************************************************}
{* ADMODDB.PAS 1.01 *}
{* Copyright (c) TurboPower Software 1995 *}
{* All rights reserved. *}
{*********************************************************}
unit AdModDB;
{-Delphi modem database component}
interface
uses
{-----RTL}
SysUtils,
Classes,
Messages,
WinTypes,
DsgnIntf,
Forms,
Controls,
{-----APD}
OoMisc,
{$IFNDEF UseAPWDLL}
AwModDB,
{$ENDIF}
AdMisc,
AdExcept,
AdIniDB;
{$IFDEF UseAPWDLL}
{$I AWMODDB.PA0}
{$ENDIF}
const
DefModemDBName = 'AWMODEM.INI';
type
{string types for modem/modem database component data}
TModemName = String[ModemNameLen];
TCmdString = String[CmdLen];
TRspString = String[RspLen];
TTagString = String[TagLen];
TTagProfString = String[TagProfLen];
TConfigString = String[ConfigLen];
TBoolStr = String[BoolLen];
TBaudStr = String[BaudLen];
{array of response strings}
PTagArray = ^TTagArray;
TTagArray = array[1..MaxTags] of TTagString;
{modem data}
PModemInfo = ^TModemInfo;
TModemInfo = record
Name : TModemName;
InitCmd : TCmdString;
DialCmd : TCmdString;
DialTerm : TCmdString;
DialCancel : TCmdString;
HangupCmd : TCmdString;
ConfigCmd : TConfigString;
AnswerCmd : TCmdString;
OkMsg : TRspString;
ConnectMsg : TRspString;
BusyMsg : TRspString;
VoiceMsg : TRspString;
NoCarrierMsg : TRspString;
NoDialToneMsg : TRspString;
ErrorMsg : TRspString;
RingMsg : TRspString;
NumErrors : Word;
Errors : TTagArray;
NumComps : Word;
Compression : TTagArray;
LockDTE : Boolean;
DefBaud : LongInt;
end;
type
TApdCustomModemDBase = class(TComponent)
protected {private}
{.Z+}
DB : PModemDatabase; {record passed to DLL calls}
Strs : TStringList; {for returning lists of modems}
Scratch : TModemData; {scratch record for passing into DLL}
Changed : Boolean; {TRUE if database data has changed}
FOpen : Boolean; {TRUE if database has been opened}
FFileName : String; {file name, used mostly at design time}
{property read/write}
procedure SetFileName(const NewName : String);
{-Update the database's file name. Reopen under the new name}
procedure SetOpen(const OpenIt : Boolean);
{-Open or close the database}
function GetRecordList : TStrings;
{-Returns the names of each modem in the database}
function GetNumModems : Integer;
{-Returns the number of modems in the database}
{utility}
procedure AssureOpen;
{-Make sure that the database is open, otherwise raise an exception}
{.Z-}
protected
property FileName : String
read FFileName write SetFileName;
public
{.Z+}
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
{.Z-}
procedure AddModem(const Modem : TModemInfo);
{-Add a modem to the database}
procedure UpdModem(const ModemName : TModemName; const Modem : TModemInfo);
{-Update a modem's record in the database}
procedure DelModem(const ModemName : TModemName);
{-Delete a modem from the database}
procedure GetModem(const ModemName : TModemName; var Modem : TModemInfo);
{-Get a modem from the database}
procedure WriteToIni(const Rec : TModemInfo; const Section, IniFile : String);
{-Write the modem to a user-specified .INI file}
procedure ReadFromIni(var Rec : TModemInfo; const Section, IniFile : String);
{-Read the modem from a user-specified .INI file}
property NumModems : Integer
read GetNumModems;
property Modems : TStrings
read GetRecordList;
property Open : Boolean
read FOpen write SetOpen;
end;
TApdModemDBase = class(TApdCustomModemDBase)
published
property FileName;
end;
{.Z+}
procedure StrsToPChars(const StrRec : TModemInfo; var PCharRec : TModemData);
{-Convert a record with string variables to a record with PChars}
procedure PCharsToStrs(const PCharRec : TModemData; var StrRec : TModemInfo);
{-Convert a record with PChar variables to a record with strings}
{.Z-}